/**
* Created by ren on 2017/2/20.
*/
<template>
  <div class='user'>
    <div class="tile is-ancestor">
      <div class="tile is-parent">
        <article class="tile is-child box">
          <table class="table is-bordered">
            <thead>
            <tr>
              <template v-for="(item,index) in headerData">
                <th>{{item.text}}</th>
              </template>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item,index) in apiData.data">
              <td>{{item.accountName}}</td>
              <td>{{item.accountTitle}}</td>
              <td>{{item.accountPhone}}</td>
              <td>{{item.accountAddr}}</td>
              <td>{{item.accountInfo}}</td>
              <td>{{item.createTime}}</td>
            </tr>
            </tbody>
          </table>
        </article>
      </div>
    </div>
  </div>
</template>

<script>
  import API from '../../util/api'
  import listHeader from '../../util/listHeaderJSON'
  export default {
    name: 'user',
    components: {},
    data: function () {
      return {
        apiData: '',
        headerData: ''
      }
    },
    methods: {
      apiRequest: function () {
        this.$http.post(API.ACCOUNTLIST, {
          page: 1,
          start: 0,
          limit: 20
        }).then((ret) => {
          const result = ret.body
          this.apiData = result
        }, (err) => {
          console.log(err)
        })
      }
    },
    mounted: function () {
      this.apiRequest(1, 1, 1)
      this.headerData = listHeader.accountList
    }
  }
</script>
<style>
  .tile.is-parent {
    padding: 0;
  }
</style>